new Vue({
    el: "#content",
    data: {
        meetingId: "", // 会议id
        makeUserCount: "", //应到人数
        isJoin: "", //是否参加
        meeting: {}, //会议详情
        notJoinCount: "", //未到人数
        joinCount: "" //实到人数
    },
    methods: {
        findDetail: function () {
            axios({
                method: "get",
                url: `/meeting/detail/${this.meetingId}`
            }).then(res => {
                if (res.data.flag) {
                    this.makeUserCount = res.data.data.makeUserCount;
                    this.isJoin = res.data.data.isJoin;
                    this.meeting = res.data.data.meeting;
                    this.notJoinCount = res.data.data.notJoinCount;
                    this.joinCount = res.data.data.joinCount;
                }
            });
        },
        joinMeeting: function () {
            if (this.isJoin == 0) {
                if (this.meeting.status == 1) {
                    layer.msg("会议已开始");
                    return;
                }
                if (this.meeting.status == 2) {
                    layer.msg("会议已结束");
                    return;
                }
            }
            axios({
                method: "post",
                url: `/meeting/joinMeeting/${this.meeting.id}`
            }).then(res => {
                layer.msg(res.data.message);
                this.findDetail();
            });
        }
    },
    created: function () {
        this.meetingId = sessionStorage.getItem("meetingId");
        this.findDetail();
    }
})